package com.egame.manage.biz.server.pu;

import java.rmi.RemoteException;

import cn.egame.common.exception.ExceptionCommonBase;
import cn.egame.interfaces.pu.AppParameter;

public class ParameterServiceImpl {
	private static ParameterServiceImpl instance = null;
	private static byte[] SyncRoot = new byte[1];
	private ParameterServiceDao dao = null;
	
	public static ParameterServiceImpl getInstance() throws ExceptionCommonBase {
		if (instance == null) {
			synchronized (SyncRoot) {
				if (instance == null) {
					instance = new ParameterServiceImpl();
				}
			}
		}
		return instance;
	}
	
	public ParameterServiceImpl() throws ExceptionCommonBase{
		super();
		dao = new ParameterServiceDao();
	}
	
	public int toUp(int appId,long loginUserId,int apptype,int parameterId)throws ExceptionCommonBase{
		return  dao.toUp(apptype, parameterId);
	}
	
	public int toDown(int appId,long loginUserId,int apptype,int parameterId)throws ExceptionCommonBase{
		return dao.toDown(apptype, parameterId);
	}
	
	public int deleteKeyword(int appId,long loginUserId,int id)throws ExceptionCommonBase{
		return dao.deleteKeyword(id);
	}
	
	public int deleteKeywords(int appId,long loginUserId,int type)throws ExceptionCommonBase{
		return dao.deleteKeywords(type);
	}

	public int upper(int appId, long loginUserId, int apptype, int parameterId) throws ExceptionCommonBase{
		return dao.upper(apptype,parameterId);
	}

	public int lower(int appId, long loginUserId, int apptype, int parameterId) throws ExceptionCommonBase{
		return dao.lower(apptype,parameterId);
	}

	public int editKeyword(int appId, long loginUserId, int type, int parameterId,String name) throws ExceptionCommonBase {
		return dao.editKeyword(type, parameterId, name);
	}
	
	public String getParameterNameById(int appId, long loginUserId, int pId)throws ExceptionCommonBase{
		return dao.getParameterNameById(pId);
	}
	
	public String getParameterNameById(int appId, long loginUserId, int pId,String remark)throws RemoteException{
		return dao.getParameterNameById(appId, loginUserId, pId, remark);
	}
	
	public AppParameter getAppParameter(int appId, long loginUserId, int pId,String remark)throws RemoteException{
		return dao.getAppParameter(appId, loginUserId, pId, remark);
	}
	
	public int getMaxSortNo(int parameterId)throws RemoteException{
		return dao.getMaxSortNo(parameterId);
	}
	
	public boolean hasExist(int parameterId,String name)throws ExceptionCommonBase{
		return dao.hasExist(parameterId, name);
	}
	
	public int getIdByNameAndParentId(String name,String remark,int parentId) throws ExceptionCommonBase{
		return dao.getIdByNameAndParentId(name, remark, parentId);
	}
}
